﻿using System.Windows.Forms;
using Business;
using Business.Entity.Vendas.MovimentacaoCaixa.SubClass.PagamentoCliente;
using Business.Forms;

namespace Vendas.Forms
{
    public partial class FormPagamentoCliente : FormDefault
    {
        public FormPagamentoCliente()
        {
            InitializeComponent();
            pagamentoClienteBindingSource.DataSource = new PagamentoCliente();
        }
        private void Salvar()
        {
            var l = (PagamentoCliente)pagamentoClienteBindingSource.DataSource;
            PagamentoClienteRepository.Save(l);
            Close();
        }

        private void cmdSalvar_Click(object sender, System.EventArgs e)
        {
            Salvar();
        }

        private void cmdCancelar_Click(object sender, System.EventArgs e)
        {
            Close();
        }

        private void FormPagamentoClente_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
        {
            switch (e.KeyData)
            {
                case Keys.F5:
                    Salvar();
                    break;
                case Keys.Escape:
                    Close();
                    break;
            }
        }
    }
}